Skip to content

Fix neuropixelsGLX for NIDQ streams, scaling, and digital channels#97

Merged
stevevanhooser merged 5 commits intomainfrom
claude/fix-neuropixels-numchans-KYDyN
Apr 7, 2026
Merged

Fix neuropixelsGLX for NIDQ streams, scaling, and digital channels#97
stevevanhooser merged 5 commits intomainfrom
claude/fix-neuropixels-numchans-KYDyN

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

  • Fix mustBePositive error: numChans/SR default to 0 as a sentinel for "read from .meta file" but mustBePositive rejected 0. Changed to mustBeNonnegative.
  • Add 'scale' option to read() (default true): Converts raw int16 data to volts via samples2volts(). Pass 'scale', false for raw int16.
  • Extend NIDQ stream support: header() now parses niAiRangeMax/Min, niMaxInt, niMNGain, niMAGain, and per-type channel counts (MN/MA/XA/DW). samples2volts() applies correct per-channel-type gains for NIDQ streams.
  • Do not voltage-scale digital channels: DW channels (NIDQ) and sync channels (imec) contain raw bit patterns, not ADC values. They now pass through as double(raw) with no gain/range scaling.
  • Accept any .meta file in reader: filenamefromepochfiles was hardcoded to *.ap.meta, rejecting .nidq.meta and .lf.meta files. Now matches any *.meta.

Test plan

  • Existing TestNeuropixelsGLX tests pass (updated for 'scale' default)
  • testFormatReadScaled / testFormatReadScaleDefault verify scaled output
  • New TestNeuropixelsGLX_nidq covers NIDQ header parsing, MN/MA/mixed voltage scaling, digital channel pass-through, and scaled/unscaled read

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1

filenamefromepochfiles was hardcoded to match *.ap.meta, rejecting
.nidq.meta and .lf.meta files. Now matches any *.meta file.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Test Results

123 tests  ±0   123 ✅ ±0   5s ⏱️ ±0s
 14 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 57e3dbc. ± Comparison against base commit 38219df.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 76.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.03%. Comparing base (b3e4e84) to head (8cc74ae).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
+ndr/+reader/neuropixelsGLX.m 76.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
+ Coverage   31.91%   32.03%   +0.11%     
==========================================
  Files          92       92              
  Lines        4646     4660      +14     
==========================================
+ Hits         1483     1493      +10     
- Misses       3163     3167       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

claude and others added 4 commits April 7, 2026 18:43
When multiple .meta files are present in the epoch (e.g., for cross-device
synchronization), derive the correct .meta file from the .bin file's base
name instead of erroring on multiple matches.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
readchannels_epochsamples and underlying_datatype crashed with
"SWITCH expression must be a scalar or a character vector" when
channeltype was passed as a cell array from the NDI call chain.
Extract the first element when channeltype is a cell, matching
the convention used by axon_abf and bjg readers.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
The analog_in case called ndr.format.neuropixelsGLX.read with (-Inf, Inf)
reading the entire file into memory, then immediately discarded the result
and re-read using read_samples with the actual s0:s1 range. Removed the
redundant full-file read.

https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
@stevevanhooser stevevanhooser merged commit 4cca66a into main Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants